<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@page contentType="text/html; charset=gb2312"%>
<%@page import="com.tss.util.*"%>
<%@page import="com.store.*"%>
<%@page import="com.jedi.*"%>
<%@page import="java.util.*"%>
<%@include file="../global_var.jsp"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
User just_user = (User)session.getAttribute("LoginUser");
String power_enable_id = "10705";
if (!just_user.hasPower(power_enable_id)) {
	out.println(strNoPowerInfo); 
	return;
}
String salename   	= ParamUtils.getParameter(request,"salename","");//销售员姓名
List list=null;
String saletel		= ParamUtils.getParameter(request,"saletel","");//电话
String salemail   = ParamUtils.getParameter(request,"salemail","");//E-mail
int comid   = Integer.parseInt( ParamUtils.getParameter(request,"comid","0"));//厂商id
String remark = ParamUtils.getParameter(request,"remark","");
String cmd = ParamUtils.getParameter(request,"cmd","");
String strErr = "";
if (cmd.trim().equals("insert")) {
	if (strErr.trim().equals("") && salename.trim().equals("")) {
		strErr = "销售姓名不能为空!";
	}
	
	if (strErr.trim().equals("") && comid==0) {
		strErr = "请选择销售所属厂商!";
	}
		if (strErr.trim().equals("") && ! salemail.trim().equals("") ) {
	if(!ParamUtils.isEmail(salemail)){
	
	strErr = "E-mail地址输入错误!";
	}
		
	}
	if (strErr.trim().equals("")) {
		Companysale comsale = new Companysale();
		comsale.setComid(comid);
		comsale.setRemark(remark);
		comsale.setSalemail(salemail);
		comsale.setSalename(salename);
		comsale.setSaletel(saletel);
		comsale.insert();
	if (comsale.hasErr()) strErr = comsale.getErrHtml();
	}

}
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
    <base href="<%=basePath%>">
    
<title></title>
    
    <meta http-equiv="pragma" content="no-cache">
    <meta http-equiv="cache-control" content="no-cache">
    <meta http-equiv="expires" content="0">
    <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
    <meta http-equiv="description" content="This is my page">
    
   <link href="style/main.css" rel="stylesheet" type="text/css">
<script language="javascript" src="js/common.js"></script>
<script language="javascript">
function chk_submit() {
	var oForm = document.operatorForm;
	oForm.cmd.value = "insert";
	return true;
}

</script>
<style type="text/css">
<!--
.STYLE1 {color: #FF0000}
.STYLE3 {color: #000000}
-->
</style>
</head>
<body  leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<table width="98%" border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td >
      <form name="operatorForm" method="post" onSubmit="return chk_submit();">
      <table width="98%" border="0" cellspacing="0" cellpadding="0">
       
      
        <tr> 
          <td height="100" align="center" valign="top" style="padding-top:10px;padding-bottom:10px;">
            <table width="96%" border="0" cellpadding="1" cellspacing="1" bgcolor="#000000">
               <tr>
                <td height="24" colspan="2" bgcolor="#EDEDF0" style="padding-left:10px;">
                提示：<font color="red">*</font> 号为必填项，请您认真填写
                </td>
              </tr>
            <%if (!strErr.trim().equals("")) {%>
             
              <tr> 
                <td height="24" colspan="2" bgcolor="#D7D7DB" style="padding-left:10px;">
                  错误提示：<font color=red><%=strErr%></font>                </td>
              </tr>
              <%}%>
            <tr> 
                <td height="24" colspan="2" bgcolor="#858585" style="padding-left:10px;">
                  <font color="#FFFFFF"><strong>厂商销售信息</strong></font>                </td>
              </tr>
              <tr>
                <td height="24" align="right" bgcolor="#D7D7DB" >销售员姓名<span style="padding-right:5px;"><font color="red">*</font></span></td>
                <td bgcolor="#EDEDF0" style="padding-left:5px;"><label>
                  <input name="salename" type="text" value="<%=salename%>"  size="30" maxlength="20">
                </label></td>
              </tr>
              <tr>
                <td height="24" align="right" bgcolor="#D7D7DB" style="padding-right:5px;">销售员电话：</td>
                <td bgcolor="#EDEDF0" style="padding-left:5px;"><label>
                  <input name="saletel" type="text" value="<%=saletel%>"  size="30" maxlength="30" >
                </label></td>
              </tr>
              <tr> 
                <td height="24" align="right" bgcolor="#D7D7DB" style="padding-right:5px;">E-mail：</td>
                <td bgcolor="#EDEDF0" style="padding-left:5px;"><label>
                  <input name="salemail" type="text"  value="<%=salemail%>" size="30"  maxlength="50">
                </label></td>
              </tr>
               <tr> 
                <td height="24" align="right" bgcolor="#D7D7DB" >所属厂商<span style="padding-right:5px;"><font color="red">*</font></span></td>
                <td bgcolor="#EDEDF0" style="padding-left:5px;">
                  <select  name="comid" style="width:150px"  >
				  <option value="0">====请选择====</option>
                    <%
                  CompanyMgr comMgr = new CompanyMgr();
                    list =comMgr.getCompanys();
                    if (list != null && list.size() > 0) {
                    	for(int i=0;i<list.size();i++) {
                    		Company item = (Company)list.get(i);
                    %>
                    <option value="<%=item.getComid()%>" <%if (item.getComid()==comid) {%> selected<%}%>><%=item.getComnam()%></option>
                    <%
                    }
                    }
                    %>
 
			</select>
          </td>
             </tr>
              <tr> 
                <td height="24" align="right" bgcolor="#D7D7DB" style="padding-right:5px;">备注：</td>
                <td bgcolor="#EDEDF0" style="padding-left:5px;"><label>
                <textarea name="remark" cols="40" rows="4"><%=remark%></textarea>
                </label></td>
              </tr>
              <tr> 
                <td bgcolor="#EDEDF0" colspan="2" align="center">
                  <input type="submit" name="submit" value="添加" class="inputButton"> 
                  <input type="reset" name="reset" value="重 写" class="inputButton">
                  <input type="hidden" name="cmd" value="">                  </td>
              </tr>
            </table>
          </td>
        </tr>
    
      </table>
          </form>
    </td>
  </tr>
</table>
<iframe width="168" height="190" name="gToday:normal:agenda.js" id="gToday:normal:agenda.js"
			src="calendar/ipopeng.htm" scrolling="no" frameborder="0" style="BORDER-RIGHT:2px ridge; BORDER-TOP:2px ridge; Z-INDEX:999; LEFT:-500px; VISIBILITY:visible; BORDER-LEFT:2px ridge; BORDER-BOTTOM:2px ridge; POSITION:absolute; TOP:0px">
		</iframe>
<%if (cmd.equals("insert") && strErr.trim().equals("")){%>
<script language="javascript">
alert("销售添加成功!");
location.href="comsale_list.jsp";
</script>
<%}%>
</body>
</html>
